import request from "@/utils/request";

/* spuList */
// 1. 获取spu列表数据的接口函数
export const reqGetSpuListData = (page, limit, category3Id) => {
  return request.get(
    "/admin/product" + `/${page}/${limit}?category3Id=` + category3Id
  );
};
// 2. 删除spuInfo数据
export const reqDeleteSpuInfo = (spuId) => {
  return request.delete(`/admin/product/deleteSpu/${spuId}`);
};


/* spuForm */
// 1. 获取spu列表所有品牌数据的接口函数
export const reqGetAllTrademarkListData = () => {
  return request.get("/admin/product/baseTrademark/getTrademarkList");
};
// 2. 获取所有的销售属性的接口函数
export const reqGetAllBaseSaleAttrListData = () => {
  return request.get("/admin/product/baseSaleAttrList");
};
// 3. 根据spuId获取图片列表
export const reqGetSpuImageListData = (spuId) => {
  return request.get(`/admin/product/spuImageList/${spuId}`);
};
// 4. 添加spuInfo
export const reqSaveSpuInfoData = (spuInfo) => {
  return request.post("/admin/product/saveSpuInfo", spuInfo);
};
// 5. 更新spuInfo数据
export const reqUpdateSpuInfoData = (spuInfo) => {
  return request.post("/admin/product/updateSpuInfo", spuInfo);
};
// 6. 根据spuId获取基本销售属性值
export const reqGetSpuSaleAttrListData = (spuId) => {
  return request.get(`/admin/product/spuSaleAttrList/${spuId}`);
};


/* skuForm */
// 1. 添加skuInfo数据
export const reqSaveSkuInfo = (skuInfo) => {
  return request.post("/admin/product/saveSkuInfo", skuInfo);
};
// 2. 根据spuId 来查看所有的skuList
export const reqCheckSkuListData = (spuId) => {
  return request.get("/admin/product/findBySpuId" + `/${spuId}`);
};

